﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QT.Windows.Shell;

namespace UrlChecker
{
    public partial class Main : GlassForm
    {
        #region Attributes

        Check.ucURL myCheckURL = null;
        Check.ucKeyword myCheckKeyword = null;
        Analysis.ucURL myAnalysisURL = null;
        Analysis.ucKeyword myAnalysisKeyword = null;

        #endregion

        public Main()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            this.statusStrip1.BackColor = AeroColor;
            this.menuStrip1.BackColor = AeroColor;
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            e.Cancel = true;
            if (MessageBox.Show("确认要退出吗？", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
            this.pMain.Controls.Clear();
            e.Cancel = false;
        }

        #region ToolStripMenuItem

        #region File

        private void toolStripMenuItem_Exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        #endregion

        #region Check&Analysis

        private void ToolStripMenuItem_CheckSnapShot_Click(object sender, EventArgs e)
        {
            if (!this.pMain.Controls.Contains(myCheckURL))
            {
                myCheckURL = new Check.ucURL();
                myCheckURL.Dock = DockStyle.Fill;
                this.pMain.Controls.Add(myCheckURL);
            }
            myCheckURL.BringToFront();
        }

        private void ToolStripMenuItem_CheckKeyword_Click(object sender, EventArgs e)
        {
            if (!this.pMain.Controls.Contains(myCheckKeyword))
            {
                myCheckKeyword = new Check.ucKeyword();
                myCheckKeyword.Dock = DockStyle.Fill;
                this.pMain.Controls.Add(myCheckKeyword);
            }
            myCheckKeyword.BringToFront();
        }

        private void toolStripMenuItem_CheckRecord_Click(object sender, EventArgs e)
        {
            MessageBox.Show("该功能未开发");
        }

        private void toolStripMenuItem_CheckPR_Click(object sender, EventArgs e)
        {
            MessageBox.Show("该功能未开发");
        }

        private void ToolStripMenuItem_AnalysisSnapShot_Click(object sender, EventArgs e)
        {
            if (!this.pMain.Controls.Contains(myAnalysisURL))
            {
                myAnalysisURL = new Analysis.ucURL();
                myAnalysisURL.Dock = DockStyle.Fill;
                this.pMain.Controls.Add(myAnalysisURL);
            }
            myAnalysisURL.BringToFront();
        }

        private void ToolStripMenuItem_AnalysisKeyword_Click(object sender, EventArgs e)
        {
            if (!this.pMain.Controls.Contains(myAnalysisKeyword))
            {
                myAnalysisKeyword = new Analysis.ucKeyword();
                myAnalysisKeyword.Dock = DockStyle.Fill;
                this.pMain.Controls.Add(myAnalysisKeyword);
            }
            myAnalysisKeyword.BringToFront();
        }

        private void toolStripMenuItem_AnalysisRecord_Click(object sender, EventArgs e)
        {
            MessageBox.Show("该功能未开发");
        }

        private void toolStripMenuItem_AnalysisPR_Click(object sender, EventArgs e)
        {
            MessageBox.Show("该功能未开发");
        }

        #endregion

        #region Setting

        private void toolStripMenuItem_Group_Click(object sender, EventArgs e)
        {
            Setting.GroupManage myGroup = new Setting.GroupManage();
            myGroup.ShowDialog();
            if (myGroup != null) myGroup.Dispose();
        }

        private void ToolStripMenuItem_Url_Click(object sender, EventArgs e)
        {
            Setting.URLManage myUrl = new Setting.URLManage();
            myUrl.ShowDialog();
            if (myUrl != null) myUrl.Dispose();

        }

        private void ToolStripMenuItem_Keyword_Click(object sender, EventArgs e)
        {
            Setting.Keyword myKeyword = new Setting.Keyword();
            myKeyword.ShowDialog();
        }

        private void toolStripMenuItem_Site_Click(object sender, EventArgs e)
        {
            Setting.SiteMange mySite = new Setting.SiteMange();
            mySite.ShowDialog();
        }

        private void ToolStripMenuItem_SearchEngine_Click(object sender, EventArgs e)
        {
            Setting.SearchEngine mySearch = new Setting.SearchEngine();
            mySearch.ShowDialog();
        }

        private void ToolStripMenuItem_Keywords_Click(object sender, EventArgs e)
        {
            Setting.Keywords myKeywords = new Setting.Keywords();
            myKeywords.ShowDialog();
        }

        private void ToolStripMenuItem_Option_Click(object sender, EventArgs e)
        {
            Setting.Option myOption = new Setting.Option();
            myOption.ShowDialog();
        }

        #endregion

        #region Tools

        private void ToolStripMenuItem_CheckUrl_Click(object sender, EventArgs e)
        {
            Tools.URL myURL = new Tools.URL();
            myURL.Show();
        }

        private void toolStripMenuItem_CheckKeywords_Click(object sender, EventArgs e)
        {
            Tools.Keywords myKeywords = new Tools.Keywords();
            myKeywords.Show();
        }

        #endregion

        #region Help

        private void ToolStripMenuItem_Cnsb_Click(object sender, EventArgs e)
        {
            Browser myBrowser = new Browser("http://www.cnsb.cn", FormWindowState.Normal);
            myBrowser.Show();
        }

        private void ToolStripMenuItem_Fengj_Click(object sender, EventArgs e)
        {
            Browser myBrowser = new Browser("http://www.fengj.com", FormWindowState.Normal);
            myBrowser.Show();
        }

        private void ToolStripMenuItem_Junk_Click(object sender, EventArgs e)
        {
            Browser myBrowser = new Browser("http://zs.fengj.com", FormWindowState.Normal);
            myBrowser.Show();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            About myAbout = new About();
            myAbout.ShowDialog();
        }

        #endregion

        #endregion
    }
}
